package org.demo.test.thread._volatile;

public class VolatileTest03 {

    static int a,b,c,x,y = 0;

    public static void main(String[] args) {
        while (true){
            a=0;b=0;c=0;x=0;y=0;

            Thread t1 = new Thread(()->{
                a = 1;
                x = b;
            });

            Thread t2 = new Thread(()->{
                b = 1;
                c = b;
                y = a;
            });

            t1.start();t2.start();

            try {
                t1.join();
                t2.join();
            }catch (InterruptedException e) {
                e.printStackTrace();
            }

            if(x==0 && y==0)
                System.out.println(a+""+b+""+c+""+x+""+y);
        }

    }

}
